package huoye.shops.huoye.operation.adapter;

import android.content.Context;
import android.view.View;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.codeideology.android.widget.recycler.RecyclerViewAdapter;

import java.math.BigDecimal;

import butterknife.BindView;
import huoye.shops.R;
import huoye.shops.base.APIUrls;
import huoye.shops.huoye.operation.model.SellOrder;
import huoye.shops.huoye.operation.model.OrderProducts;
import huoye.shops.utils.StockUtils;
import huoye.shops.widget.RoundImageView;


/**
 * Created by uesr on 2018/8/10.
 */

public class OrderDetailsShopMessageAdapter extends RecyclerViewAdapter<OrderDetailsShopMessageAdapter.ViewHolder,OrderProducts> {



    public OrderDetailsShopMessageAdapter(Context context) {
        super(context, R.layout.item_order_details_shop_manage);
    }

    @Override
    protected ViewHolder initViewHolder(View view, int i) {

        return new ViewHolder(view);
    }

    @Override
    protected void bindView(ViewHolder holder, final OrderProducts products, int i) {
        if(getContext() != null){
            Glide.with(getContext())
                    .load(APIUrls.COMMON_CONFIG.TYPE_COMMON_ALIYUN+products.getProductImg())
                    .dontAnimate()
                    .placeholder(R.mipmap.ic_wait_logo)
                    .error(R.mipmap.ic_error)
                    .into(holder.rvShop);
        }

        holder.tvShop.setText(products.getProductName());
        String buyMoeny = StockUtils.moenyStyle(products.getBuyMoney());
        holder.tvMoney.setText(buyMoeny +"");
        holder.tvNumber.setText("数量 ："+products.getBuyNum());



    }


    public class ViewHolder extends RecyclerViewAdapter.ViewHolder {


        @BindView(R.id.item_order_details_shop_manage_tv_shop)
        TextView tvShop;
        @BindView(R.id.item_order_details_shop_manage_tv_money)
        TextView tvMoney;
        @BindView(R.id.item_order_details_shop_manage_tv_number)
        TextView tvNumber;




        @BindView(R.id.item_order_details_shop_manage_rv)
        RoundImageView rvShop ;




        public ViewHolder(View itemView) {
            super(itemView);
        }
    }



}
